package com.oneinlet

import io.netty.buffer.Unpooled
import io.netty.channel.Channel
import io.netty.util.AttributeKey

/**
 * Created by WangZiHe on 2019/1/7/007
 * QQ/WeChat:648830605
 * QQ-Group:368512253
 * Blog:www.520code.net
 * Github:https://github.com/yancheng199287
 */
object Constant {
    val channelIdAttributeKey = AttributeKey.newInstance<String>("pandoraChannelID")

    fun makeHeartBeatPack(channelId: String): Pandora {
        val pandora = Pandora()
        pandora.msgType = Pandora.MsgType.HEARTBEAT_PACKET.type
        pandora.data = Unpooled.EMPTY_BUFFER.array()
        pandora.content = "心跳数据包"
        pandora.channelId = channelId
        return pandora
    }

    fun makeClosePack(channelId: String): Pandora {
        val pandora = Pandora()
        pandora.msgType = Pandora.MsgType.DISCONNECT_FROM_YCLINET_TO_YCSERVER.type
        pandora.data = Unpooled.EMPTY_BUFFER.array()
        pandora.content = "断开通道"
        pandora.channelId = channelId
        return pandora
    }

}